package com.zxq.frame.dlt645;

public enum EFrameCmd {

    Unknown(-1),
    /**
     * 保留
     */
    Retain(0),
    /**
     * 广播校时
     */
    BroadcastTiming(8),
    /**
     * 读数据
     */
    ReadData(17),
    /**
     * 读后续数据
     */
    ReadFollowData(18),
    /**
     * 读通信地址
     */
    ReadPostalAddress(19),
    /**
     * 写数据
     */
    WriteData(20),
    /**
     * 写通信地址
     */
    WritePostalAddress(21),
    /**
     * 冻结指令
     */
    FreezeCmd(22),
    /**
     * 更改通信速率
     */
    UpdateCodeRate(23),
    /**
     * 修改密码
     */
    UpdatePsw(24),
    /**
     * 最大需量清零
     */
    MaximumDemandReset(25),
    /**
     * 电表清零
     */
    AmmeterClear(26),
    /**
     * 事件清零
     */
    EventClear(27);

    int value;
    EFrameCmd(int i) {
        this.value = i;
    }

    public int getValue() {
        return value;
    }

    public static EFrameCmd getType(int value) {
        EFrameCmd eFrameCmd = Unknown;
        switch (value) {
            case 0:
                eFrameCmd = Retain;
                break;
            case 8:
                eFrameCmd = BroadcastTiming;
                break;
            case 17:
                eFrameCmd = ReadData;
                break;
            case 18:
                eFrameCmd = ReadFollowData;
                break;
            case 19:
                eFrameCmd = ReadPostalAddress;
                break;
            case 20:
                eFrameCmd = WriteData;
                break;
            case 21:
                eFrameCmd = WritePostalAddress;
                break;
            case 22:
                eFrameCmd = FreezeCmd;
                break;
            case 23:
                eFrameCmd = UpdateCodeRate;
                break;
            case 24:
                eFrameCmd = UpdatePsw;
                break;
            case 25:
                eFrameCmd = MaximumDemandReset;
                break;
            case 26:
                eFrameCmd = AmmeterClear;
                break;
            case 27:
                eFrameCmd = EventClear;
                break;
        }
        return eFrameCmd;
    }


}
